<?php
class Offline_course_model extends CI_Model{

 	function __construct(){
    	parent::__construct();
	}


	/**
	* 函数功能介绍：返回课程列表（用于分页显示）
	* 创建人:  Yang Ningshu
	* @param id int
	* @return array
	*/
	function get_offline_course_list($limit = 0, $offset = 10){


		$sql = "select sc.*,cour.title,cour.cate_id,cate.name as cate_name,campus.name as campus_name from edu_o2o_student_course sc 
			left join edu_o2o_course cour on cour.id = sc.course_id
			left join edu_course_cate cate on cate.id = cour.cate_id
			left join edu_o2o_school_campus campus on campus.id = sc.school_campus_id
			where sc.user_id = {$this->user_data['id']} and sc.course_type = 3 LIMIT $limit, $offset";
		
	
		$result = $this->db->query($sql)->result_array();
		$row_num =  $this->db->query('SELECT FOUND_ROWS() as row_num;')->row_array();

		$this->db->trans_complete();

		return array("total_count" => $row_num['row_num'], "result" => $result);
	}


}